<?php 
session_start();
require_once('config/config.php');


if(isset($_SESSION['login'])){
	
	if (isset($_GET['do'])) {
		switch ($_GET['do']) {
			case "afficher":
				require_once("./controleur/ctrl_consulter.php");
				new Ctrl_consulter();
	        	break;
	        case "modifier":
	        	require_once("./controleur/ctrl_modifier.php");
	        	new Ctrl_modifier();
	        	break;
	        case "deconnexion":
	        	session_destroy();
	        	require_once("./controleur/ctrl_acceuil.php");
	        	new Ctrl_acceuil();
	        	break;
	        default:
	        	
	        	require_once("./controleur/ctrl_acceuil.php");
	        	new Ctrl_acceuil();
	        	break;
		}
	}
	// Si non, on affiche l'index
	else {
		require_once("./controleur/ctrl_accueil.php");
	    new Ctrl_acceuil();
	}
}
else {
	if (isset($_GET['do'])) {
	    require_once("./controleur/ctrl_authentification.php");

		new Ctrl_authentification();
	}
	else {
		require_once("controleur/ctrl_accueil.php");
	    new Ctrl_acceuil();
	}
} 
?>
